/*
 * @lc app=leetcode.cn id=804 lang=javascript
 *
 * [804] 唯一摩尔斯密码词
 */

// @lc code=start
/**
 * @param {string[]} words
 * @return {number}
 */
var uniqueMorseRepresentations = function(words) {
    let str="abcdefghijklmnopqrstuvwxyz"
    let arr=[".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."]
    let set=new Set()
    words.forEach((item)=>{
        let temp=""
        for(let i=0;i<item.length;i++){
        temp+=arr[str.indexOf(item[i])]
        }
        set.add(temp)
    })
    return set.size
};
// @lc code=end

